package com.chaipuyu.service.impl;

import com.chaipuyu.dao.GoodsDao;
import com.chaipuyu.entity.*;
import com.chaipuyu.service.GoodsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者: cc又瘦啦
 * 开发日期: 2021/12/20
 **/
@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    GoodsDao goodsDao;

    @Override
    public User selectUser(User user) {
        return goodsDao.selectUser(user);
    }

    @Override
    public PageInfo<Goods> selectGoods(Pojo pojo, Integer pageNum, Integer pageSize,User user) {

        PageHelper.startPage(pageNum,pageSize);

        List<Goods> list = goodsDao.selectGoods(pojo,user);

        return new PageInfo<Goods>(list);
    }

    @Override
    public List<Brand> getBrandList() {
        return goodsDao.getBrandList();
    }

    @Override
    public List<Type> getTypeList() {
        return goodsDao.getTypeList();
    }

    @Override
    public int insert(Goods goods) {
        return goodsDao.insert(goods);
    }

    @Override
    public User selectByusername(String uname) {
        return goodsDao.selectByusername(uname);
    }

    @Override
    public User selectByupwd(String uname, String upwd) {
        return goodsDao.selectByupwd(uname,upwd);
    }
}
